﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe.Notice
{
    public partial class Notice_List : Form
    {
        DataSet MSGList;
        public Notice_List()
        {
            InitializeComponent();
        }

        private void Notice_List_Load(object sender, EventArgs e)
        {
            load();
        }

        public void load()
        {

            MedEQ.Service1 sop = new MedEQ.Service1();
            MSGList = sop.Message_List();

            dataGridView1.DataSource = MSGList.Tables[0];
            dataGridView1.Columns[0].Width = 30;
            dataGridView1.Columns[1].Width = 200;
            dataGridView1.Columns[2].Width = 400; ;
            for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
            {
                this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        
        
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            sop.Del_Message(MSGList.Tables[0].Rows[dataGridView1.CurrentCell.RowIndex][0].ToString());
            load();
        }

        private void button3_Click(object sender, EventArgs e)
        {


            Add_Notice ti = new Add_Notice();
            ti.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            load();
        }
    }
}
